import { waitTime, leisure } from '@/utils/otherUtil';

// 运行时配置
export async function getInitialState() {
  // 模拟走接口
  await waitTime(500);
  var rs = {
    data: {
      name: '小红',
      //权限
      authority: ['AccessGet', 'AccessSet'],
    },
  };

  return rs.data;
}

export function render(oldRender) {
  oldRender();
  hiddenLoading();
}

// 清空页面级别loading (初始html中的)
function hiddenLoading() {
  setTimeout(() => {
    leisure(() => {
      var pageIoading = document.getElementById('pageIoading');
      if (pageIoading) {
        pageIoading.style.opacity = 0;
        setTimeout(() => {
          pageIoading.remove();
        }, 300);
      }
    });
  }, 1200);
}
